<%@page import="com.railway.news.model.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>

<html>
<head>
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/default/easyui.css">
	<link type="text/css" rel="stylesheet" href="${ctx}/css/themes/icon.css">
	
	<link type="text/css" rel="stylesheet" href="${ctx}/css/default.css" />
	<script type="text/javascript" src="${ctx}/scripts/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${ctx}/scripts/xheditor-1.1.12-zh-cn.min.js"></script>		
	
	<title><%=NewsColums.TABLE_ALIAS%>新增</title>
	<SCRIPT type="text/javascript">
	    function openURL(urlstr,width,height){  
      	var url  = '${ctx}/news/Category/showCategoryTree.do'; 
           var returnVal = window.showModalDialog(url, window, "dialogWidth="+width+"px;dialogHeight="+height+"px;status:0;scroll:no");   
           if(returnVal == undefined) {           
          	 return;           
           }
            form1.catId.value = returnVal[0]; 
            form1.catname.value = returnVal[1]; 
        }   
		var setting = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick,
				onCheck: onCheck
			}
		};

		

		function onClick(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}

		function onCheck(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
			    form1.catId.value += nodes[i].id;
				v += nodes[i].name + ",";

			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#citySel");
			cityObj.attr("value", v);
		}

		function showMenu() {
			var cityObj = $("#citySel");
			var cityOffset = $("#citySel").offset();
			$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

			$("body").bind("mousedown", onBodyDown);
		}
		function hideMenu() {
			$("#menuContent").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
				hideMenu();
			}
		}

		$(document).ready(function(){
		

			
		});
		//-->
	</SCRIPT>
</head>
<body>
	<form id="form1" action="${ctx}/news/News/save.do" method="post">
		<input type="submit" value="提交" />
		<input type="button" value="返回列表" onclick="window.location='${ctx}/news/News/list.do'"/>		
		<input type="button" value="后退" onclick="history.back();"/>
			<input type="hidden" name="fileImg"	value="" />
			<input id="fromUrl" name="fromUrl" value="${model.fromUrl}"
				type="hidden"   />
		<table class="formTable">
			<input type="hidden" id="id" name="id" value="${model.id}"/>
		    <input id="returnUrl" name="returnUrl" value="${requestScope.returnUrl}" type="hidden"   />
		<!-- ONGL access static field: @package.class@field or @vs@field -->
			
			
			<!--tr>	
				<td class="tdLabel">
		<%=NewsColums.ALIAS_CATEGORY%>
				</td>	
				<td>
				<input id="catname" name="catname" value=""
			       type="text" readonly  class="easyui-validatebox" onclick="javascript:openURL('Dept',300,200)"/>
				
				</td>
			</tr-->
			
			<input  id="catId" name="catId" value="${model.catId}"
				type="hidden"  class="easyui-validatebox"   />
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_TITLE%>:
				</td>	
				<td>
				<input id="title" name="title" value="${model.title}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<!-- tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_DTITLE%>:
				</td>	
				<td>
				<input id="dtitle" name="dtitle" value="${model.dtitle}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_AUTHOR_ID%>:
				</td>	
				<td>
				<input  id="authorId" name="authorId" value="${model.authorId}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->	 
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_CONTENT_TEXT%>:
				</td>	
				<td>
				<textarea class="xheditor {skin:'default'}" id="contentText" name="contentText" value="${model.contentText}"  rows="12" cols="80" style="width: 80%">
			      	</textarea>
				</td>
			</tr>
			
			
			<!-- tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_CONTENT_HTML%>:
				</td>	
				<td>
				<input id="contentHtml" name="contentHtml" value="${model.contentHtml}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			
			<!--tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_FROM_NAME%>:
				</td>	
				<td>
				<input id="fromName" name="fromName" value="${model.fromName}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			

			
			
			<!--tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_BROWSE%>:
				</td>	
				<td>
				<input id="browse" name="browse" value="${model.browse}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			
			<!--tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_RECOM%>:
				</td>	
				<td> 
				<input id="recom" name="recom" value="${model.recom}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			
			<!--tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_TOP_STATE%>:
				</td>	
				<td>
				<input id="topState" name="topState" value="${model.topState}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr-->
			
			
			<tr>	
				<td class="tdLabel">
					<%=NewsColums.ALIAS_STATE%>:
				</td>	
				<td>
				<input id="state" name="state" value="${model.state}"
				type="text"  class="easyui-validatebox"   />
				</td>
			</tr>
		</table>
	</form>
			<Iframe src="${ctx}/files/Files/showFileImg.do"; width="250" height="200" scrolling="no" frameborder="0"></iframe> 
	
</body>
<script>
//begin $(document).ready(handler)
$(function(){
$('#form1').submit(function(){
alert(form1.fromUrl);
 form1.fromUrl.value = form1.fileImg.value; 
 alert(orm1.fromUrl.value);

});}
);//end $(document).ready(handler)
</script>
</html>

